package cn.bjc;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
//开启Eureka客户端注解,此注解可以不用加,
@EnableEurekaClient
// 开启熔断功能
@EnableCircuitBreaker
public class OrderApp {
    public static void main(String[] args) {
        SpringApplication.run(OrderApp.class, args);
    }
    
    
    //@Bean:让当前方法返回的对象成为一个bean对象
    @Bean
    @LoadBalanced   //让restTemplate拥有负载均衡能力
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
